<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $giftList = [
            ["id"=>"1","name"=>"沙发"],
            ["id"=>"2","name"=>"iPhone8 PLUS"],
            ["id"=>"3","name"=>"白葡萄酒"],
            ["id"=>"4","name"=>"888元现金红包"],
            ["id"=>"5","name"=>"数据线"],
            ["id"=>"6","name"=>"10积分"],
            ["id"=>"7","name"=>"30元话费"],
            ["id"=>"8","name"=>"3w欢乐豆"]
        ];

        $key = array_rand($giftList);

        $get = $giftList[$key];

        $this->ajaxReturn($get, "JSON");
    }
}